package com.ns.scs.ads.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ns.core.vo.bs.BaseVO;
import com.ns.scs.ads.dto.AdsSpacePageDto;
import com.ns.scs.ads.entry.AdsSpaceEntry;
import com.ns.scs.ads.mapper.AdsSpaceEntryMapper;
import com.ns.scs.ads.vo.AdsSpaceExtraVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 广告位业务实现
 *
 * @author lw
 * @since 2024/09/23
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class AdsSpaceServiceImpl extends ServiceImpl<AdsSpaceEntryMapper, AdsSpaceEntry> implements IAdsSpaceService {
    private final AdsSpaceEntryMapper mapper;

    @Override
    public Page<AdsSpaceExtraVO> getList(AdsSpacePageDto dto) {
        return mapper.getList(dto, new Page<>(dto.getCurrent(), dto.getSize()));
    }

    @Override
    public List<BaseVO> getOptions() {
        return mapper.getOptions();
    }

    @Override
    public AdsSpaceEntry getByCode(String spaceCode) {
        return mapper.selectByCode(spaceCode);
    }
}
